package cn.jhc.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jhc.bean.ShopBean;
import cn.jhc.dao.ShopDAO;
@WebServlet("/deletejita.do")
public class DeleteJitaServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	req.setCharacterEncoding("UTF-8");
	String bl=req.getParameter("bl");
	ShopDAO dao=new ShopDAO();
	List<ShopBean> list = null;
	try{
		if(bl.equals("del")){
		String isbn=req.getParameter("isbn");
		dao.deletejita(isbn);}
		list=dao.getAllTitles();
	}
	catch (Exception e) {
		e.printStackTrace();
	}
		
	req.setAttribute("titles", list);
	RequestDispatcher dispatcher = req
			.getRequestDispatcher("/houtai_deletejita.jsp");
	dispatcher.forward(req, resp);
	return;
}
@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
}
